package com.fcscs.cservice.domain.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.fcscs.core.domain.HistoricalEntity;
import com.fcscs.cservice.common.CServiceCommonEnums;
import com.fcscs.cservice.common.CServiceCommonEnums.BookingStatus;
import com.fcscs.cservice.common.CServiceCommonEnums.NotifyType;
import com.fcscs.cservice.common.CServiceConstants;

public class BookingUpdate extends HistoricalEntity{

	/**
	 * 
	 */
	private static final long serialVersionUID = -89866805842899912L;
	/**
	 * 
	 */
	private long restaurantId;
	private long bookingId;
	private long guestId;
	private Date reservationDate;
	private String guestFirstName;
	private String guestLastName;
	private Boolean gender;
	private String phoneNumber;
	private String eamil;
	private List<NotifyType> notifyList;
	private String notify;
	private Boolean smoking;
	private Date arrivalDate;
	private Date departureDate;
	private BookingStatus bookingStatus;
	private Integer noOfGuest;
	private String note;
	//Add
	private Long titleId;
	
	public long getRestaurantId() {
		return restaurantId;
	}
	public void setRestaurantId(long restaurantId) {
		this.restaurantId = restaurantId;
	}
	public long getBookingId() {
		return bookingId;
	}
	public void setBookingId(long bookingId) {
		this.bookingId = bookingId;
	}
	public long getGuestId() {
		return guestId;
	}
	public void setGuestId(long guestId) {
		this.guestId = guestId;
	}
	public Date getReservationDate() {
		return reservationDate;
	}
	public void setReservationDate(Date reservationDate) {
		this.reservationDate = reservationDate;
	}
	public String getGuestFirstName() {
		return guestFirstName;
	}
	public void setGuestFirstName(String guestFirstName) {
		this.guestFirstName = guestFirstName;
	}
	public String getGuestLastName() {
		return guestLastName;
	}
	public void setGuestLastName(String guestLastName) {
		this.guestLastName = guestLastName;
	}
	public Boolean getGender() {
		return gender;
	}
	public void setGender(Boolean gender) {
		this.gender = gender;
	}
	public String getPhoneNumber() {
		return phoneNumber;
	}
	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}
	public String getEamil() {
		return eamil;
	}
	public void setEamil(String eamil) {
		this.eamil = eamil;
	}
	public String getNotify() {
		if(notifyList != null && notifyList.size() !=0 ){
			StringBuffer sb = new StringBuffer();
			for(CServiceCommonEnums.NotifyType s : notifyList){
				sb.append(s+CServiceConstants.DATA_LINK);
			}
			notify = sb.toString().substring(0, sb.length()-1);
		}
		return notify;
	}

	private void setNotify(String notify) {
		this.notify = notify;
	}
	public List<CServiceCommonEnums.NotifyType> getNotifyList() {
		List<CServiceCommonEnums.NotifyType> lit = new ArrayList<CServiceCommonEnums.NotifyType>();
		if (notify != null) {
			String[] nfiy = notify.split(CServiceConstants.SPLIT_MARK);
			for (String s : nfiy) {
				lit.add(CServiceCommonEnums.NotifyType.valueOf(s));
			}
		}
		notifyList = lit;
		return notifyList;
	}

	public void setNotifyList(List<CServiceCommonEnums.NotifyType> notf) {
		if(notf.size() != 0){
			StringBuffer sb = new StringBuffer();
			for(CServiceCommonEnums.NotifyType s : notf){
				sb.append(s+CServiceConstants.DATA_LINK);
			}
			setNotify(sb.toString().substring(0, sb.length()-1));
		}else{
			setNotify(null);
		}
		this.notifyList = notf;
	}
	public Boolean getSmoking() {
		return smoking;
	}
	public void setSmoking(Boolean smoking) {
		this.smoking = smoking;
	}
	public Date getArrivalDate() {
		return arrivalDate;
	}
	public void setArrivalDate(Date arrivalDate) {
		this.arrivalDate = arrivalDate;
	}
	public Date getDepartureDate() {
		return departureDate;
	}
	public void setDepartureDate(Date departureDate) {
		this.departureDate = departureDate;
	}
	public BookingStatus getBookingStatus() {
		return bookingStatus;
	}
	public void setBookingStatus(BookingStatus bookingStatus) {
		this.bookingStatus = bookingStatus;
	}
	public Integer getNoOfGuest() {
		return noOfGuest;
	}
	public void setNoOfGuest(Integer noOfGuest) {
		this.noOfGuest = noOfGuest;
	}
	public String getNote() {
		return note;
	}
	public void setNote(String note) {
		this.note = note;
	}
	public Long getTitleId() {
		return titleId;
	}
	public void setTitleId(Long titleId) {
		this.titleId = titleId;
	}

	@Override
	public DBLoc getDBLoc() {
		return DBLoc.GUEST;
	}	
}
